from .error import APIException


class Success(APIException):
    code = 201 # 新增资源成功
    msg = (
        '保存成功'
    )
    error_code = 2001


class SuccessLike(Success):
    code = 201 # 新增资源成功
    msg = (
        '操作成功'
    )
    error_code = 2001


class DeleteSuccess(Success):
    code = 204 # HTTP的状态码中代表删除成功,默认是没有返回值的,因为都删了还有什么数据
    msg = (
        '删除成功'
    )
    error_code = 2004


class SaveError(APIException):
    code = 500 # 服务器内部错误
    msg = (
        '保存失败'
    )
    error_code = 5000 # 保存失败


class ParameterError(APIException):
    code = 400 # 验证错误
    msg = (
        '验证错误'
    )
    error_code = 4000 # 参数错误


class NotFound(APIException):
    code = 404
    msg = (
        '未找到'
    )
    error_code = 4004


class AuthFailed(APIException):
    code = 401 # 权限错误
    error_code = 4001
    msg = '授权失败'


class Forbidden(APIException):
    code = 403 # 禁止访问
    msg = (
        '禁止访问'
    )
    error_code = 4003


class RepeatGift(APIException):
    code = 400 # 验证错误
    msg = (
        '重复添加'
    )
    error_code = 4000


class __ClientTypeError(APIException):
    code = 400
    msg = (
        '验证错误'
    )
    error_code = 1006
